import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/lget/LGetScaffold.dart';
import 'package:liuxlcommon/lget/LState.dart';
import 'package:liuxlcommon/util/string_utils.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_box.dart';
import 'package:ladder_cash/app/app.dart';
import 'package:ladder_cash/app/com/view/my_app_bar.dart';
import 'package:ladder_cash/app/key_mix.dart';
import 'package:ladder_cash/generated/assets.dart';
import 'package:ladder_cash/value/app_const.dart';

import 'user_info_logic.dart';

class UserInfoPage extends StatefulWidget {
  const UserInfoPage({Key? key}) : super(key: key);

  @override
  State<UserInfoPage> createState() => _UserInfoPageState();
}

class _UserInfoPageState extends LState<UserInfoPage> {
  final logic = Get.put(UserInfoLogic());

  @override
   get init {
  logic.getData();
  }
  @override
  get body => LGetScaffold<UserInfoLogic>(
      appBar: MyAppBar(App.localeEn?"Identity information":"Informasi identitas"),
      builder: () =>LFlexV([
        10.lsh,
        // LImage.easy(Assets.icUserHead,71.w,71.w),
        LText.easy("usernane",20.sp,fw5).margin(top: 15.w,bottom:10.w ),
        LText.easy(StringUtils().phoneHiding(App.userInfoModel.username),14.sp,fw5).margin(bottom:25.w),
        itemView(App.localeEn?"ID number":"nomor ID",logic.data['name'.hx]),
        itemView(App.localeEn?"Name":"Nama",logic.data['idNumber'.hx]),
        itemView(App.localeEn?"Birthday":"Hari ulang tahun",logic.data['neighbor'.hx]),
        [
          LImage.easy(logic.data['yawned'.hx],90.w,138.w),LExpand(),
          LImage.easy(logic.data['fastened'.hx],90.w,138.w),
        ].row.css('width: 339px;height: 138px;background: #F5F5F5;padding:24px 17px;border-radius: 8px;')
      ]).size(375.w, null));

  itemView(title,value){
    return LFlexH([
      LText.easy(title??"",14.sp,fw6).flex(1),
      LText.easy(value??"",14.sp),
    ]).css('width: 339px;height: 60px;background: #F5F5F5;border-radius: 8px;padding:0 15px').margin(bottom:20.w);
  }

  @override
  void dispose() {
    Get.delete<UserInfoLogic>();
    super.dispose();
  }

  @override
  // TODO: implement finish
  get finish {}



}